Strongly typed, compile-time safe and loosely coupled data persistence
نویسنده
چکیده
A large number of approaches have been developed to simplify construction of, and to reduce errors in, data-driven applications. However, these approaches have not been particularly concerned with compile-time type safety. Type mismatch errors between program and the database schema occur quite often during program development, and the techniques used in these approaches often defer error checking on database operations until runtime. In this thesis, we take a different approach from those previously proposed, based on strict type checking at compile time, type inference, higher-order functions, phantom types, object relational mapping, and loosely coupled database interaction. Instead of using external, literal XML file and string type SQL, we embed the mapping meta data and user defined queries directly in the program, the type safety of which is guaranteed by the program compiler. Such a result is achieved by introducing additional database schema information and using type avatars, a dummy structure used to extend the type checking to embedded queries, during compilation. We show that this approach is practical and effective by implementing a compile-time type-safe object relational framework, called Qanat, in the OCaml programming language and using a loosely coupled SQL database. We further report experimental results obtained by running a number of benchmark tests, and compare the resulting Qanat applications with the equivalent, raw database driver based applications.
منابع مشابه
An Implementation of Hybrid A Concurrent, Object-Oriented Language∗
This paper is a report on a prototype implementation of Hybrid, a strongly-typed, concurrent, object-oriented language. The implementation we describe features a compile-time system for translating Hybrid object type definitions into C, a run-time system for supporting communication, concurrency and object persistence, and a type manager that mediates between the two.
متن کاملAn Implementation of HybridA Concurrent , Object - Oriented
This paper is a report on a prototype implementation of Hybrid, a strongly-typed, concurrent, object-oriented language. The implementation we describe features a compile-time system for translating Hybrid object type deenitions into C, a run-time system for supporting communication, concurrency and object persistence, and a type manager that mediates between the two.
متن کاملA Typeful Integration of SQL into Curry
We present an extension of the declarative programming language Curry to support the access to data stored in relational databases via SQL. Since Curry is statically typed, our emphasis on this SQL integration is on type safety. Our extension respects the type system of Curry so that run-time errors due to ill-typed data are avoided. This is obtained by preprocessing SQL statements at compile t...
متن کاملCompile-time meta-programming in Converge
Compile-time meta-programming allows programs to be constructed by the user at compile-time. Few modern languages are capable of compile-time meta-programming, and of those that do, many of the most powerful are statically typed functional languages. In this paper I present the dynamically typed, object orientated language Converge which allows compile-time meta-programming in the spirit of Tem...
متن کاملWhen Generic Functions Use Dynamic Values
Dynamic types allow strongly typed programs to link in external code at run-time in a type safe way. Generic programming allows programmers to write code schemes that can be specialized at compiletime to arguments of arbitrary type. Both techniques have been investigated and incorporated in the pure functional programming language Clean. Because generic functions work on all types and values, t...
متن کامل